package ch.nostromo.tiffanys.clients.desktop.gui.board;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.net.URL;

import uk.ac.cam.cl.projectcharlie2010.clients.desktop.controller.DesktopController;

import ch.nostromo.lib.controller.NosResourcesException;

public class ChessSet extends BufferedImage {

  public ChessSet(Component c) throws NosResourcesException {
    super(240, 80, BufferedImage.TYPE_INT_ARGB);
    Image im = null;
    URL url = DesktopController.getInstance().getGuiResource("ChessPieces.gif");
    im = Toolkit.getDefaultToolkit().getImage(url);
    MediaTracker mT = new MediaTracker(c);
    mT.addImage(im, 0);
    try {
      mT.waitForID(0);
    } catch (InterruptedException ie) {
      // Do nothing
    }
    Graphics g = getGraphics();
    g.drawImage(im, 0, 0, c);
  }

}
